<?php

//获取表单
function GetForm($name){
	return M('form')->where(array('name'=>$name))->getField('content');
}
//内容
function AURL($url,$id){
	$url = $url ? $url :$id;
	$website = F('url');
	if(C('URL_MODEL') == 2){
		return str_replace('{url}',$url,$website['aurl']);
	}else{
		return U('Content/index',array('id'=>$url));
	}
}
//分类单页
function CURL($url){
	if(preg_match('/[0-9]+/',$url)){
		$url = M('category')->where(array('id'=>$url))->getField('url');
	}
	$website = F('url');
	if(C('URL_MODEL') == 2){
		return str_replace('{url}',$url,$website['curl']);
	}else{
		return U('Category/index',array('id'=>$url));
	}
}
//获取内容
function GET($table,$limit='',$ord='',$where=''){
	return M($table)->where($where)->order($ord)->limit($limit)->select();
}

//获取单个内容
function GET_ONCE($table,$ord='',$where=''){
	return M($table)->where($where)->order($ord)->find();
}